home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pibt3sp1.arc
/
GETDOWNL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-09-26
|
6KB
|
174 lines
(*----------------------------------------------------------------------*)
(* Get_Download_Protocol --- Get File Transfer Protocol *)
(*----------------------------------------------------------------------*)
FUNCTION Get_Download_Protocol : Transfer_Type ;
(*----------------------------------------------------------------------*)
(* *)
(* Function: Get_Download_Protocol *)
(* *)
(* Purpose: Gets file name and transfer protocol for download. *)
(* *)
(* Calling Sequence: *)
(* *)
(* Transtyp := Get_Download_Protocol: Transfer_Type; *)
(* *)
(* Remarks: *)
(* *)
(* Calls: KeyPressed *)
(* Async_Send *)
(* Async_Receive *)
(* *)
(*----------------------------------------------------------------------*)
VAR
Transfer_Kind : Transfer_Type;
Transfer_Menu : Menu_Type;
I : INTEGER;
Pacing_String : STRING[1];
OK_File_Name : BOOLEAN;
Flag : BOOLEAN;
BEGIN (* Get_Download_Protocol *)
(* Set up menu for protocol inquiry *)
WITH Transfer_Menu DO
BEGIN
Menu_Size := 9;
Menu_Default := ORD( Default_Transfer_Type ) + 1;
IF Menu_Default > 9 THEN Menu_Default := 1;
Menu_Row := 10;
Menu_Column := 20;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 50;
Menu_Height := 16;
END;
FOR I := 1 TO 9 DO
WITH Transfer_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) Ascii';
2: Menu_Item_Text := 'b) Xmodem (Checksum)';
3: Menu_Item_Text := 'c) Xmodem (CRC)';
4: Menu_Item_Text := 'd) Kermit';
5: Menu_Item_Text := 'e) Telink';
6: Menu_Item_Text := 'f) Modem7 (Checksum)';
7: Menu_Item_Text := 'g) Modem7 (CRC)';
8: Menu_Item_Text := 'h) Ymodem';
9: Menu_Item_Text := 'i) Ymodem (Batch)';
END (* CASE *);
END;
(* Get transfer protocol *)
Transfer_Menu.Menu_Title := 'Choose file transfer protocol for download:';
Menu_Display_Choices( Transfer_Menu );
Transfer_Kind := Transfers[ Menu_Get_Choice( Transfer_Menu ,
Dont_Erase_Menu ) ];
(* Get file name to use if not *)
(* batch transfer *)
Ok_File_Name := FALSE;
FileName := '';
IF Transfer_Kind IN [ Ascii, Xmodem_Chk, Xmodem_Crc, Ymodem ] THEN
BEGIN
REPEAT
GoToXY( 2 , 11 );
ClrEol;
WRITE('Filename.Ext ? ');
READLN(FileName);
ASSIGN(AFile,FileName);
(*$I- *)
RESET( AFile );
(*$I+ *)
IF Int24Result <> 0 THEN
OK_File_Name := TRUE
ELSE
BEGIN
OK_File_Name := YesNo( FileName + ' already exists, overwrite? ');
(*$I-*)
CLOSE( AFile );
(*$I+*)
GoToXY( 1 , WhereY );
ClrEol;
END;
UNTIL( OK_File_Name );
ASSIGN( AFile, FileName );
(*$I- *)
REWRITE( AFile );
(*$I+ *)
IF Int24Result <> 0 THEN
BEGIN
Transfer_Kind := None;
WRITELN;
WRITELN('*** Can''t open output file, download cancelled ***');
END;
END (* Get file name *);
(* Set default delays for Ascii transfers *)
Char_Delay := 0;
Line_Delay := 0;
CASE Transfer_Kind OF
Xmodem_Crc,
Xmodem_Chk : (*$I-*)
CLOSE( Afile );
(*$I+*)
Telink,
Ymodem,
Ymodem_Batch: BEGIN
GoToXY( 2 , 11 );
Use_Time_Sent := YesNo(' Stamp file with time/date '+
'provided by host? ');
END;
Ascii : BEGIN
GoToXY( 2 , 12 );
WRITE('Receiving file ', FileName );
ClrEol;
GoToXY( 2 , 13 );
WRITE('Hit Alt-R to stop transfer.');
ClrEol;
DELAY( Two_Second_Delay );
(*$I-*)
CLOSE( AFile );
(*$I+*)
END;
ELSE ;
END (* CASE *);
(* Return transfer protocol type *)
Get_Download_Protocol := Transfer_Kind;
DELAY( Two_Second_Delay );
(* Remove this window *)
Restore_Screen( Saved_Screen );
Reset_Global_Colors;
END (* Get_Download_Protocol *);